home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 October: Mac OS SDK / Dev.CD Oct 96 SDK / Dev.CD Oct 96 SDK1.toast / Development Kits (Disc 1) / Open Transport / Sample Code / DLPI / ATM PCI DLPI / Sources / ATMDLPI.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-05-17  |  5.1 KB  |  163 lines  |  [TEXT/MPS ]

  1. /***********************************************************
  2.     File:        ATMDLPI.h
  3.  
  4.     Contains:    ATM Open Transport Streams DLPI PCI driver Header
  5.     
  6.     Written by:    
  7.  
  8.     Copyright:    © 1994 by Apple Computer, Inc., all rights reserved.
  9.  
  10.     Change History (most recent first):
  11.     
  12.     To Do:
  13.  ***********************************************************/
  14.  
  15. #ifndef __ATMDLPI__
  16. #define __ATMDLPI__
  17.  
  18. /***********************************************************
  19.   INCLUDES
  20.  ***********************************************************/
  21.  
  22. #include <OpenTptModule.h>
  23. #include <OpenTptDevLinks.h>
  24. #include <OpenTptAtm.h>
  25.  
  26. #include <OpenTptPCISupport.h>
  27.  
  28. #include <miioccom.h>
  29. #include <stropts.h>
  30. #include <dlpi.h>
  31.  
  32. #include <Kernel.h>
  33. #include <DriverServices.h>
  34. #include <Devices.h>
  35. #include <CodeFragments.h>
  36.  
  37. /***********************************************************
  38.   DEFINES
  39.  ***********************************************************/
  40.  
  41. /* Read and Write queue water marks */
  42. #define kQueueHighMark        32768
  43. #define kQueueLowMark        128
  44.  
  45. /* Maximum number of minor devices per port supported */
  46. #define MAX_MINORDEVICES     256
  47.  
  48. /* Maximum number of connections per port supported */
  49. #define MAX_CONNECTIONS     256
  50.  
  51. #define kMaxPendingRecvMessages 10
  52.  
  53. /***********************************************************
  54.   STRUCTS AND TYPEDEFS
  55.  ***********************************************************/
  56.  
  57. /*
  58.  * Internal Return codes for DLPI message handling routines
  59.  */
  60. enum DLPIInternalCodes {
  61.     kdlpiDONE            = 1,
  62.     kdlpiRETRY            = 2
  63. };
  64.  
  65. /*
  66.  * Special return codes fo ABCVendorTransmit() routine
  67.  */
  68. enum ATMTransmitReturnCodes {
  69.     kFlowControl        = 1
  70. };
  71.  
  72. /*
  73.  * Write Scheduler Types
  74.  */
  75. enum DLPISchedulerTypes {
  76.     kdlpiBufcallType    = 1,
  77.     kdlpiTimerType        = 2
  78. };
  79.  
  80. /*
  81.  * VC types for flags field in ConnectTableEntry structure
  82.  */
  83. enum ATMVCITypes {
  84.     kVCIIn    = 0x00000001,
  85.     kVCIOut    = 0x00000002
  86. };
  87.  
  88. struct _ABCVendorCardSpecific;
  89.  
  90. struct _ConnectTableEntry;
  91. struct _MinorDeviceTableEntry;
  92. struct _PortTableEntry;
  93.  
  94. /*
  95.  * ConnectTableEntry, one per VC
  96.  */
  97. struct _ConnectTableEntry {
  98.     UInt32                    connectTableIndex;    // index of this entry in the connectTable
  99.     PVCAddress                pvc;                // PVCAddress of this VC
  100.     AALType                    aal;                // AAL Type
  101.     QOSClass                qos;                // QOS Class
  102.     TrafficDesc                traffic;            // Traffic Descriptor
  103.     UInt32                    flags;                // flags for this entry
  104.                                                 // either kVCIIn or kVCIout or both
  105.     queue_t*                rdq;                // read queue for this VC
  106.     struct _MinorDeviceTableEntry*    parentMinorDevice;    // parent MinorDeviceTableEntry
  107.     struct _ConnectTableEntry*        nextConnection;        // next connection, if more than one present
  108.                                                         // for the parent MinorDeviceTableEntry 
  109.     struct _ConnectTableEntry*        prevConnection;        // previous connection, if more than one present
  110.                                                         // for the parent MinorDeviceTableEntry 
  111.  
  112. };
  113.  
  114. /*
  115.  * MinorDeviceTableEntry, one per stream
  116.  */
  117. struct _MinorDeviceTableEntry {
  118.     UInt32                minorTableIndex;            // index of this entry in the minorDeviceTable
  119.     UInt32                minorNum;                    // minor device number of this stream
  120.     UInt32                dlstate;                    // DLPI state of this stream
  121.     queue_t*            rdq;                        // read queue for this stream
  122.     UInt32                numConnections;                // number of VCs currently enabled on this stream
  123.     UInt32                useUDInd;                    // whether to use DL_UNITDATA_IND on this stream
  124.     struct _ConnectTableEntry*    firstConnection;    // first ConnectTableEntry of this stream, no specific order
  125.     UInt32                timeoutID;                    // id for bufcalls and timeouts 
  126.     UInt16                idType;                        // type of id (bufcall or timeout)
  127. };
  128.  
  129. /*
  130.  * PortPrivateData, one per port (i.e per card)
  131.  * A global will be declared of this structure type.
  132.  */
  133. struct _PortPrivateData {
  134.     RegEntryID                nodeEntryID;                // our entry in the Name Registry
  135.     TPortRecord*            port;                        // our TPortRecord
  136.     UInt8                    ourPhyAddress[kATMPhysicalAddressLength];    // our ATM address
  137.     UInt32                    ourPeakCellRate;                            // peak user cell rate
  138.     UInt32                    numCardOpens;                                // number of streams open
  139.     struct _MinorDeviceTableEntry**    minorDeviceTable;    // the table of all minor devices, i.e. streams
  140.     struct _ConnectTableEntry**        connectTable;        // the table of all VCs
  141.     UInt32                    maxConnectTableIndex;        // the current max. index in the connectTable
  142.     UInt32                    currentFwdPeakCellRateAllocated;    // current max. user cell rate allocated
  143.                                                                 // in the forward direction
  144.     UInt32                    currentBwdPeakCellRateAllocated;    // current max. user cell rate allocated
  145.                                                                 // in the backward direction
  146.     SInt32                    TxDeferredTaskCookie;    // the transmit deferred task cookie
  147.     SInt32                    RxDeferredTaskCookie;    // the transmit deferred task cookie
  148.     struct _ABCVendorCardSpecific*    cardSpecific;    // vendor specific data for the atm card
  149. };
  150.  
  151. typedef struct _ConnectTableEntry ConnectTableEntry;
  152. typedef struct _MinorDeviceTableEntry MinorDeviceTableEntry;
  153. typedef struct _PortPrivateData PortPrivateData;
  154.  
  155. /***********************************************************
  156.   EXTERNS
  157.  ***********************************************************/
  158.  
  159. extern void ATMDLPI_unitdata_ind(ConnectTableEntry* conn, UInt16 vpi, UInt16 vci, mblk_t* mp);
  160. extern ConnectTableEntry* find_connection(UInt16 vpi, UInt16 vci, UInt32 flags);
  161.  
  162. #endif /* __ATMDLPI__ */
  163.